﻿using System.Text;

namespace CloudShot.Utils
{
    public static class MD5
    {
        public static string Create(string input)
        {
            if (string.IsNullOrEmpty(input))
            {
                return input;
            }

            System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
            byte[] bs = Encoding.UTF8.GetBytes(input);
            bs = x.ComputeHash(bs);
            StringBuilder s = new StringBuilder();

            foreach (byte b in bs)
            {
                s.Append(b.ToString("x2").ToLower());
            }

            return s.ToString();
        }
    }
}
